package com.ldu.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.ldu.dao.mapper.NoticeMapper;
import com.ldu.pojo.Notice;
import com.ldu.service.NoticeService;

@Service("NoticeService")
public class NoticeServiceImpl implements NoticeService{
	 @Resource
	 private NoticeMapper noticeMapper;

	@Override
	public List<Notice> getNoticeList() {
		
		return noticeMapper.getNoticeList();
	}

	@Override
	public List<Notice> getAllNoticeList() {

		return noticeMapper.getAllNoticeList();
	}

	@Override
	public void insertSelective(Notice notice) {
		noticeMapper.insertSelective(notice);
		
	}

	@Override
	public int getNoticeNum() {
		List<Notice> notice= noticeMapper.selectNoticeList();
		return notice.size();
	}


	@Override
	public List<Notice> getPageNotice(int pageNum, int pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		List<Notice> notice =noticeMapper.selectNoticeList();
		return notice;
	}

	@Override
	public void deleteNoticeByPrimaryKeys(int id) {
		noticeMapper.deleteByPrimaryKey(id);
	}

	@Override
	public List<Notice> getPageNoticeByNotice(Integer id,Integer status, int pageNum, int pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		List<Notice> notice =noticeMapper.getPageNoticeByNotice(id,status);
		return notice;
	}


	/*@Override
	public Notice getNoticeById(int id) {
		return noticeMapper.selectNoticeById(id);
	}*/

	@Override
	public Notice getNoticeById(int id) {
		Notice notice = noticeMapper.selectById(id);
		return notice;
	}

	/*public List<Notice> getNoticeById(Integer id);*/
	@Override
	public void updateByPrimaryKey(Integer id, Notice notice) {
		notice.setId(id);
		noticeMapper.updateByPrimaryKey(notice);

	}


	/*@Override
	public void updateNoticePassById(Integer id,Notice notice) {
		notice.setId(id);
		noticeMapper.updateNoticeById(notice);

	}


	@Override
	public void updateNoticeRefuseById(Integer id,Notice notice) {
		notice.setId(id);
		noticeMapper.updateNoticeById(notice);

	}*/


}
